#define _CRT_SECURE_NO_WARNINGS 1
int minNumberInRotateArray(vector<int>& nums) {
    // write code here

    int left = 0;
    int right = nums.size() - 1;
    int mid = 0;
    if (nums[left] < nums[right])
    {
        return nums[0];
    }
    while (left < right)
    {
        if (right - left == 1)
        {
            mid = right;

            break;
        }
        mid = left + ((right - left) >> 1);
        if (nums[left] == nums[mid] && nums[left] == nums[right])
        {
            int result = nums[left];
            for (int i = left + 1; i < right; i++)
            {
                if (nums[i] < result)
                {
                    result = nums[i];
                }
            }
            return result;
        }

        if (nums[mid] >= nums[left])
        {
            left = mid;

        }
        else
        {
            right = mid;

        }




    }
    return nums[mid];
}